<?php
/*
 * 短信通知
 */
class Notice_SMS
{
	private $_to, $_message;

	public function __construct ()
	{
		$this->_sms_mt = new Notice_SMS_MT;
	}

	public function to ($mobile)
	{
		$this->_to = $mobile;
		return $this;
	}

	public function message ($message)
	{
		$this->_message = $message;
		return $this;
	}

	public function send ($message = NULL)
	{
		if (! empty($message))
			$this->_message = $message;

		if (empty($this->_to) || empty($this->_message))
			return FALSE;

		$message = @iconv('utf8', 'gbk', $this->_message);
		if (empty($message))
			return FALSE;

		$this->_sms_mt->send($this->_to, $message);
	}
}
